package com.ka.component;

import java.util.ArrayList;
import java.util.List;

public class MessageValidate {

	private List<String> messageList;

	public MessageValidate() {
		messageList = new ArrayList<String>();
	}

	private List<String> getMessageList() {
		return messageList;
	}

	private void setMessageList(List<String> messageList) {

		this.messageList = messageList;

	}

	public void addErrorMessage(String str) {

		messageList.add(str);

	}

	public void takeMessageFromOtherMessage(MessageValidate msg) {

		if (messageList.size() == 0) {
			this.setMessageList(msg.getMessageList());
		} else {
			messageList.addAll(msg.getMessageList());
		}

	}

	public List<String> outMessage() {
		return messageList;
	}

	public void clear() {
		messageList.clear();
	}
}
